package com.hmall.feign.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignConfig {


    /**
     * 指定负载均衡策略
     *
     * @return
     */
    @Bean
    public IRule loadBalancer() {
        return new RandomRule();
    }

    @Bean
    public RequestInterceptor requestInterceptor(){
        return new MyFeignInterceptor();
    }
}
